<%=
          for status <- ["error", "warning", "success", "question"] do
            render BlockScoutWeb.CommonComponentsView, "_modal_status.html", status: status
          end
        %>
<link rel="stylesheet" href="<%= static_path(@conn, "/css/export-csv.css") %>">
<section class="container">
  <div class="card">
    <div class="card-body">
      <h1 class="card-title list-title-description"><%= gettext "Export Data" %></h1>

      <div>
        <p class="card-subtitle list-title-description">Export <%= type_display_name(@type) %> for address <%= link(
              @address_hash_string,
              to: address_path(@conn, :show, @address_hash_string)
            ) %> to CSV file</p>
	    </div>

      <div class="dates-container">
      from <input class="js-datepicker js-datepicker-from form-control" type="text" /> to <input class="js-datepicker js-datepicker-to form-control" type="text" />
      </div>

      <div id="recaptcha" class=mb-3></div>
      <button
        <%= if Application.get_env(:block_scout_web, :recaptcha)[:v2_client_key], do: "disabled", else: "" %>
        id="export-csv-button"
        class="button button-primary"
        style="padding: 10px 25px;"
        data-link=<%= address_transaction_path(@conn, type_download_path(@type)) %>
        data-address-hash=<%= address_checksum(@address_hash_string) %>
        data-type=<%= @type %>
      ><%= gettext("Download") %></button>
      </a>
    </div>
  </div>
  <script defer data-cfasync="false" src="<%= static_path(@conn, "/js/csv-download.js") %>"></script>
  <%= cond do %>
    <% Application.get_env(:block_scout_web, :recaptcha)[:v2_client_key] -> %>
      <script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" defer></script>
    <% Application.get_env(:block_scout_web, :recaptcha)[:v3_client_key] -> %>
      <script src="https://www.google.com/recaptcha/api.js?render=<%= Application.get_env(:block_scout_web, :recaptcha)[:v3_client_key] %>" defer></script>
    <% true -> %>
  <% end %>
</section>